﻿CREATE TABLE [dbo].[WorkLog]
(
	[WorkLogId] [int] IDENTITY(1,1) NOT NULL,
    [Name] [nvarchar](50) NOT NULL,
    [Description] [varchar] (150) NULL,
	[Minutes] [decimal] NOT NULL,
    [Workdate] [date] NOT NULL,
    [TaskId] [int] NOT NULL,
    [PersonId] [int] NOT NULL,
    [DateCreated] [datetime] NOT NULL,
    [CreatedBy] [varchar] (50) NOT NULL,
    [DateUpdated] [datetime] NOT NULL,
    [UpdatedBy] [varchar] (50) NOT NULL,
     CONSTRAINT [PK_WorkLog] PRIMARY KEY CLUSTERED 
    (
	    [worklogId] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[WorkLog]  WITH CHECK ADD  CONSTRAINT [FK_WorkLog_Person] FOREIGN KEY([PersonId])
REFERENCES [dbo].[Person] ([PersonId])
GO

ALTER TABLE [dbo].[WorkLog] CHECK CONSTRAINT [FK_WorkLog_Person]
GO

ALTER TABLE [dbo].[WorkLog]  WITH CHECK ADD  CONSTRAINT [FK_WorkLog_Task] FOREIGN KEY([TaskId])
REFERENCES [dbo].[Task] ([TaskId])
GO

ALTER TABLE [dbo].[WorkLog] CHECK CONSTRAINT [FK_WorkLog_Task]
GO
